/*
this is responsible for maintaining the state of all the game objects like sprites and stuff.  you will 
likely need to make changes here to account for state changes from remote hosts, although you may not need 
to modify it depending on your architecture (I probably wouldn't)
*/

#pragma once
#include "model.h"
#include "GameObject.h"
#include <vector>
#include <list>
#include "SpaceShip.h"

using namespace std;


enum objectType{
PRIMITIVE,	//lines, points, and stuff
SPRITE,	//dumb objects that are computer-controlled
PLAYERSPRITE //objects that are player-controlled
};

class GameModel :
	public Model
{
public:
	GameModel(void);
	~GameModel(void);

	//main player for this game.  
	GameObject* GetPlayerObject();

	//get any object who's ID we care about
	GameObject* GetObjectByID(int id);

	//destroyobject removes an object 
	void DestroyObject(int objectID);

	//add a new object of some type
	void AddNewObject(GameObject* obj, objectType oType);

	//update non-player objects
	void UpdateObjects();

	//destroy all objects in the model
	void Eradicate();

	Mobile* GetNextMobile(bool resetIterator);

	list<GameObject*>* GetAllGameObjects();	
	
protected:
	list<GameObject*> _objects;
	GameObject* player;

	list<GameObject*>::iterator spriteIterator;
	list<GameObject*>::iterator mobileIterator;

	Vertex* pointBuffer;
	Vertex* lineBuffer;
	int pointCount;
	int pointBufferSize;
	
	int lineCount;
	int lineBufferSize;
};
